import java.util.Scanner;

public class MathPractice {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入要生成的题目数量：");
        int num = scanner.nextInt();

        for (int i = 0; i < num; i++) {
            int a = (int) (Math.random() * 100) + 1;
            int b = (int) (Math.random() * 100) + 1;
            char op = Math.random() < 0.5 ? '+' : '-';

            System.out.print(a + " " + op + " " + b + " = ?");
            int result = op == '+' ? a + b : a - b;
            System.out.println("\n正确答案是：" + result);

            if (i < num - 1) {
                System.out.println();
            }
        }
    }
}
